import React, { Component } from 'react';
import {Route,Switch,Redirect} from 'react-router-dom'
import Home from 'home/Home.jsx'
import Cart from 'cart/Cart.jsx'
import Classify from 'classify/Classify.jsx'
import My from 'my/My.jsx'
import NoFound from 'noFound/NoFound.jsx'



class index extends Component {
    render() {
        return (
            <div style={{height:"100%"}}>
                {/* 唯一渲染 */}
                <Switch>
                    <Route path='/home' component={Home}/>
                    <Route path='/cart' component={Cart}/>
                    <Route path='/classify' component={Classify}/>
                    <Route path='/my' component={My}/>

                    {/* 路由重定向 */}
                    <Redirect exact from='/' to='/home'/>
                    {/* 404 */}
                    <Route component={NoFound}/>
                </Switch>
            </div>
        );
    }
}

export default index;